WebMessage sample page

This page demonstrates basic interaction between the LuaRT host app and the Webview widget by means of Web Messages.

Posting Messages

Messages can be posted from the LuaRT host app to the Webview widget using the functions Webview:postmessage(). Try to click the button at the top to send the message {"SetColor":"blue"}. It should change the text color of this paragraph.

Receiving Messages

The LuaRT host app can receive messages by setting a \code>Webview:onMessage() event handler. If you enter text and click "Send", this page will send a message to the LuaRT host app which will change the text of the title bar.

Round trip

The LuaRT host app can send messages back in response to received messages. If you click "Get window bounds", the LuaRT host app will report back the bounds of its window, which will appear in the text box.